package ipl;

import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;

import org.apache.hadoop.io.WritableComparable;

public class IntPair implements WritableComparable {
  public int first;
  public int second;

  public IntPair(int a, int b) {
    first = a;
    second = b;
  }

  public IntPair(long a, long b) {
    first = (int) a;
    second = (int) b;
  }

  public IntPair() {
    first = 0;
    second = 0;
  }

  @Override
  public void write(DataOutput out) throws IOException {
    out.writeInt(first);
    out.writeInt(second);

  }

  @Override
  public void readFields(DataInput in) throws IOException {
    // TODO Auto-generated method stub
    first = in.readInt();
    second = in.readInt();
  }

  @Override
  public int compareTo(Object other) {
    return (first > ((IntPair) other).first) ? 0 : -1;
  }
}
